home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_17.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
3KB
|
127 lines
function createPowerupContainer()
{
createEmptyMovieClip("powerupContainer",powerupDepth);
powerupCount = 0;
}
function spawnPowerup(xSpot, powType)
{
var _loc1_ = powType;
var _loc2_ = true;
i = 0;
while(i < theHull.upgrades.length)
{
if(theHull.upgrades[i] == 0)
{
_loc2_ = false;
}
i++;
}
if(_loc2_)
{
spawn1UP(xSpot);
}
else
{
while(theHull.upgrades[_loc1_ - 1] > 0)
{
_loc1_ = _loc1_ + 1;
if(_loc1_ > 5)
{
_loc1_ = 1;
}
}
powerupCount++;
var _loc3_ = powerupContainer.attachMovie("powerup" + _loc1_,"powerup" + powerupCount,powerupCount);
_loc3_._y = (- _loc3_._height) / 2;
_loc3_._x = xSpot;
_loc3_.pType = _loc1_;
_loc3_.move = powerupMover;
_loc3_.hit = powerupHit;
}
}
function spawn1UP(xSpot)
{
if(theHull.lives < 12)
{
powerupCount++;
var _loc1_ = powerupContainer.attachMovie("extraLife","powerup" + powerupCount,powerupCount);
_loc1_._y = (- _loc1_._height) / 2;
_loc1_._x = xSpot;
_loc1_.move = powerupMover;
_loc1_.hit = extralifeHit;
}
}
function powerupHit()
{
var _loc2_ = this;
playSound("sound.powerup");
playSound("sound.ready." + _loc2_.pType);
doWhiteFlash();
var _loc1_ = 0;
i = 0;
while(i < 5)
{
if(theHull.upgrades[i] > 0)
{
theHull.upgrades[i] = 1;
_loc1_ = _loc1_ + 1;
}
i++;
}
theHull.upgrades[_loc2_.pType - 1] = 1;
theHull.attachMovie(theHull.upgrades[0] + "" + theHull.upgrades[1] + "" + theHull.upgrades[2] + "" + theHull.upgrades[3] + "" + theHull.upgrades[4],"ship",0);
addScore(100);
_loc2_.removeMovieClip();
}
function extralifeHit()
{
doWhiteFlash();
addLife();
playSound("sound.1up");
this.removeMovieClip();
}
function powerupMover()
{
var _loc1_ = this;
_loc1_._y += 3;
if(_loc1_._y - _loc1_._height / 2 > Stage.height)
{
_loc1_.removeMovieClip();
}
}
function powerupExecute()
{
for(tp in powerupContainer)
{
p = powerupContainer[tp];
p.move();
if(p.hitTest(theHull) && theHull.alive)
{
p.hit();
}
}
}
function bigFatCheater()
{
var _loc2_ = true;
var _loc1_ = new Array();
i = 0;
while(i < theHull.upgrades.length)
{
if(theHull.upgrades[i] == 0)
{
_loc2_ = false;
_loc1_.push(i);
}
i++;
}
if(!_loc2_ && theHull.alive)
{
playSound("sound.cheat");
doWhiteFlash();
var _loc3_ = _loc1_[random(_loc1_.length)];
theHull.upgrades[_loc3_] = 1;
theHull.attachMovie(theHull.upgrades[0] + "" + theHull.upgrades[1] + "" + theHull.upgrades[2] + "" + theHull.upgrades[3] + "" + theHull.upgrades[4],"ship",0);
}
}